<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- 包含头部信息用于适应不同设备 -->
<meta name="viewport"
	content="width=device-width, initial-scale=1
    	user-scalable=no">
<!-- 包含 bootstrap 样式表 -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/BootStrap/css/bootstrap.min.css">
<!-- uedite -->
<script type="text/javascript"
	src="${pageContext.request.contextPath}/utf8-jsp/ueditor.config.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/utf8-jsp/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8"
	src="${pageContext.request.contextPath}/utf8-jsp/lang/zh-cn/zh-cn.js"></script>
<title>试题管理</title>

<script type="text/javascript">
	function ok(row, questionId) {
		/* 	href = "${pageContext.request.contextPath }/studentexamscore?questtionId=${s.id}&method=add" */
		var form = document.forms[row - 1];
		form.action = "${pageContext.request.contextPath }/studentexamscore?questionId="
				+ questionId + "&method=add";
		form.method = "post";
		form.submit();
	}

	//面包屑导航
	function setbreadcrumb() {
		$("ol.breadcrumb", parent.document).html(
				"<li><a href='javascript:void(0)''>首页</a></li>"
						+ "<li class='active'>修改试题<li>");
	}
</script>

</head>
<body>

	<%
		int a = 0;
	%>

	<div class="text-center">
		<strong style="font-size: 20px;">试题概览</strong>
		<!-- <strong class="pull-right">总人数：xx</strong> -->
	</div>
	<table class="table table-hover table-bordered table-striped">
		<thead>
			<tr>
				<th>序号</th>
				<th>试题类型</th>
				<th>试题描述</th>
				<th>编辑</th>
				<th style="width: 45px;">删除</th>
			</tr>
		</thead>
		<tbody>
			<c:if test="${!empty list}">

				<c:forEach items="${list}" var="s">

					<c:if test="${status.count%2==0 } ">
						<tr class="success">
					</c:if>
					<c:if test="${status.count%2!=0 }">
						<tr>
					</c:if>
					<td><%=++a%></td>
					<td>${s.type}</td>
					<td>${s.object.description}</td>
					<td><form action="" class="form-horizontal" role="form">
							<input type="hidden" name="homeworkid" value="${s.homeworkid}">
							<input type="hidden" name="answertrue" value="${s.object.answer}">
							<input type="hidden" name="sid" value="${sid}">
							<c:if test="${s.type == '选择题'}">
							A<input type="radio" value="A" name="answer">
							B<input type="radio" value="B" name="answer">
							C<input type="radio" value="C" name="answer">
							D<input type="radio" value="D" name="answer">
								<input type="hidden" name="qid" value="${s.object.choiceid }">
								<input type="hidden" name="type" value="1">
							</c:if>
							<c:if test="${s.type == '填空题'}">
								<input type="text" name="answer">
								<input type="hidden" name="qid" value="${s.object.blankidid }">
								<input type="hidden" name="type" value="2">
							</c:if>
							<c:if test="${s.type == '判断题'}">
							正确<input type="radio" name="answer" value="1">
							错误<input type="radio" name="answer" value="0">
								<input type="hidden" name="qid" value="${s.object.judgeid }">
								<input type="hidden" name="type" value="3">
							</c:if>
						</form></td>
					<td><button onclick="ok('<%=a%>','${s.id }')"
							${s.isDone==1?'disabled':''}>确认</button></td>
					</tr>

				</c:forEach>

			</c:if>
		</tbody>
	</table>

	<!-- JavaScript 放置在文档最后面可以使页面加载速度更快 -->
	<!-- 可选: 包含 jQuery 库 -->
	<script
		src="${pageContext.request.contextPath }/BootStrap/js/jquery-3.1.1.js"></script>
	<!-- 可选: 合并了 Bootstrap JavaScript 插件 -->
	<script
		src="${pageContext.request.contextPath }/BootStrap/js/bootstrap.min.js"></script>
</body>
</html>